{{- /*
FixIt theme assets partial
===============================================
- Third-party libraries and plugins
- Theme assets and plugins
  - Config script
  - MathJax plugin
  - Mermaid plugin
  - Theme script
  - Custom Assets block
  - Custom script
===============================================
*/ -}}

{{- $noop := .WordCount -}}
{{- $params := partial "function/params.html" -}}
{{- $cdn := .Site.Store.Get "cdn" | default dict -}}
{{- $fingerprint := .Site.Store.Get "fingerprint" -}}
{{- $config := (.Store.Get "this").config -}}
{{- $config = dict "version" (hugo.Store.Get "version") | merge $config -}}
{{- $author := partial "function/get-author-map.html" .Params.author -}}
{{- $uniqueFileId := "" -}}
{{- $languagePrefix := .Site.LanguagePrefix -}}
{{- with .File -}}
  {{- $uniqueFileId = .UniqueID -}}
{{- end -}}

{{- /* Search */ -}}
{{- if .Site.Params.search | and .Site.Params.search.enable -}}
  {{- $search := .Site.Params.search -}}
  {{- /* TODO update "lib/autocomplete-js/umd/index.production.js" */ -}}
  {{- $source := $cdn.autocompleteJS | default "lib/autocomplete/autocomplete.min.js" -}}
  {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
  {{- $config = dict "maxResultLength" $search.maxResultLength "snippetLength" $search.snippetLength "highlightTag" $search.highlightTag "noResultsFound" (T "assets.noResultsFound") | dict "search" | merge $config -}}
  {{- if eq $search.type "algolia" -}}
    {{- $source := $cdn.algoliasearchJS | default "lib/algoliasearch/algoliasearch-lite.umd.min.js" -}}
    {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
    {{- $config = dict "type" "algolia" "algoliaIndex" $search.algolia.index "algoliaAppID" $search.algolia.appID "algoliaSearchKey" $search.algolia.searchKey | dict "search" | merge $config -}}
  {{- else if eq $search.type "fuse" -}}
    {{- with .Site.Home.OutputFormats.Get "search" -}}
      {{- $config = dict "type" "fuse" "fuseIndexURL" .RelPermalink | dict "search" | merge $config -}}
    {{- end -}}
    {{- $source := $cdn.fuseJS | default "lib/fuse/fuse.min.js" -}}
    {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
    {{- $config = dict "isCaseSensitive" $search.fuse.isCaseSensitive "minMatchCharLength" $search.fuse.minMatchCharLength "findAllMatches" $search.fuse.findAllMatches "location" $search.fuse.location "threshold" $search.fuse.threshold "distance" $search.fuse.distance "ignoreLocation" $search.fuse.ignoreLocation "useExtendedSearch" $search.fuse.useExtendedSearch "ignoreFieldNorm" $search.fuse.ignoreFieldNorm | dict "search" | merge $config -}}
  {{- else if eq $search.type "cse" -}}
    {{- $config = dict "type" "cse" | dict "search" | merge $config -}}
    {{- $cse := .Site.Params.cse -}}
    {{- $config = dict "resultsPage" $cse.resultsPage "gotoResultsPage" (T "assets.gotoResultsPage") | dict "cse" | merge $config -}}
    {{- if (eq $cse.engine "google") | and $cse.google.cx  -}}
      {{- $config = dict "engine" "google" "cx" $cse.google.cx "searchIn" (T "assets.searchIn" "Google") | dict "cse" | merge $config -}}
    {{- end -}}
    {{- if eq $cse.engine "bing" -}}
      {{- /* Unsupported */ -}}
    {{- end -}}
  {{- else if eq $search.type "post-chat" -}}
    {{- $config = dict "type" "post-chat" | dict "search" | merge $config -}}
  {{- end -}}
{{- end -}}

{{- /* instant.page */ -}}
{{- if $params.instantPage -}}
  {{- $source := $cdn.instantPage | default "lib/instant-page/instantpage.min.js" -}}
  {{- dict "Source" $source "Fingerprint" $fingerprint "Attr" `type="module"` "Async" true "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
{{- end -}}

{{- /* JSON Viewer */ -}}
{{- if .Store.Get "hasJsonViewer" -}}
  {{- $source := $cdn.jsonViewerElementJS | default "lib/json-viewer-element/json-viewer-element.umd.js" -}}
  {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
{{- end -}}

{{- /* twemoji */ -}}
{{- if $params.twemoji -}}
  {{- $source := $cdn.twemojiJS | default "lib/twemoji/twemoji.min.js" -}}
  {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
  {{- $config = dict "twemoji" true | merge $config -}}
{{- end -}}

{{- /* lightgallery */ -}}
{{- if $params.lightgallery | or (eq $params.lightgallery "force") -}}
  {{- $source := $cdn.lightgalleryCSS | default "lib/lightgallery/css/lightgallery-bundle.min.css" -}}
  {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "store/style.html" -}}
  {{- $source := $cdn.lightgalleryJS | default "lib/lightgallery/lightgallery.min.js" -}}
  {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
  {{- $source := $cdn.lightgalleryThumbnailJS | default "lib/lightgallery/plugins/thumbnail/lg-thumbnail.min.js" -}}
  {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
  {{- $source := $cdn.lightgalleryZoomJS | default "lib/lightgallery/plugins/zoom/lg-zoom.min.js" -}}
  {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
  {{- $config = dict "lightgallery" true | merge $config -}}
{{- end -}}

{{- /* Code wrapper */ -}}
{{- $code := $params.code | default dict -}}
{{- if $code.enable -}}
  {{- $config = $code.maxShownLines | dict "maxShownLines" | dict "code" | merge $config -}}
  {{- if ne $code.edit false -}}
    {{- $config = dict "editable" true "editLockTitle" (T "assets.editLockTitle") "editUnLockTitle" (T "assets.editUnLockTitle") | dict "code" | merge $config -}}
  {{- end -}}
  {{- if ne $code.copy false -}}
    {{- $config = T "assets.copyToClipboard" | dict "copyTitle" | dict "code" | merge $config -}}
  {{- end -}}
{{- end -}}

{{- /* Sharer.js */ -}}
{{- if .Store.Get "hasSharer" -}}
  {{- $source := $cdn.sharerJS | default "lib/sharer/sharer.min.js" -}}
  {{- dict "Source" $source "Fingerprint" $fingerprint "Async" true "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
{{- end -}}

{{- /* TypeIt */ -}}
{{- if .Store.Get "hasTyped" -}}
  {{- $typeit := .Site.Params.typeit -}}
  {{- $source := $cdn.typeitJS | default "lib/typeit/index.umd.js" -}}
  {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
  {{- $config = dict "speed" $typeit.speed "cursorSpeed" $typeit.cursorSpeed "cursorChar" $typeit.cursorChar "duration" $typeit.duration "loop" $typeit.loop | dict "typeit" | merge $config -}}
{{- end -}}

{{- /* KaTeX */ -}}
{{- $math := .Store.Get "math" -}}
{{- if .Store.Get "hasKaTeX" -}}
  {{- $source := $cdn.katexCSS | default "lib/katex/katex.min.css" -}}
  {{- dict "Source" $source "Fingerprint" $fingerprint "Preload" true | dict "Page" . "Data" | partial "store/style.html" -}}
  {{- /* Copy-tex extension */ -}}
  {{- if $math.katex.copyTex -}}
    {{- $source := $cdn.katexCopyTexJS | default "lib/katex/copy-tex.min.js" -}}
    {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
  {{- end -}}
{{- end -}}

{{- /* MathJax */ -}}
{{- if .Store.Get "hasMathJax" -}}
  {{- $mathjax := $math.mathjax -}}
  {{- $mjoc := $mathjax.options | default dict -}}
  {{- $mjo := dict -}}
  {{- if eq $mjoc.enableMenu false -}}
    {{- $mjo = dict "enableMenu" false | merge $mjo -}}
  {{- end -}}
  {{- with $mjoc.ignoreHtmlClass -}}
    {{- $mjo = dict "ignoreHtmlClass" . | merge $mjo -}}
  {{- end -}}
  {{- with $mjoc.skipHtmlTags -}}
    {{- $mjo = dict "skipHtmlTags" . | merge $mjo -}}
  {{- end -}}
  {{- with $mjoc.includeHtmlTags -}}
    {{- $mjo = dict "includeHtmlTags" . | merge $mjo -}}
  {{- end -}}
  {{- $config = dict
    "cdn" $mathjax.cdn
    "tex" ($mathjax.tex | default dict)
    "packages" ($mathjax.packages | default dict)
    "macros" ($mathjax.macros | default dict)
    "loader" ($mathjax.loader | default dict)
    "options" $mjo
    | dict "mathjax"
    | merge $config
  -}}
{{- end -}}

{{- /* ECharts */ -}}
{{- if .Store.Get "hasEcharts" -}}
  {{- $source := $cdn.echartsJS | default "lib/echarts/echarts.min.js" -}}
  {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
  {{- $lightTheme := resources.Get "lib/echarts/theme/light.yml" | transform.Unmarshal -}}
  {{- $darkTheme := resources.Get "lib/echarts/theme/dark.yml" | transform.Unmarshal -}}
  {{- $config = dict "lightTheme" $lightTheme "darkTheme" $darkTheme | dict "echarts" | merge $config -}}
{{- end -}}

{{- /* Mapbox GL */ -}}
{{- if .HasShortcode "mapbox" -}}
  {{- $source := $cdn.mapboxGLCSS | default "lib/mapbox-gl/mapbox-gl.css" -}}
  {{- dict "Source" $source "Minify" true "Fingerprint" $fingerprint "Preload" true | dict "Page" . "Data" | partial "store/style.html" -}}
  {{- $source = $cdn.mapboxGLJS | default "lib/mapbox-gl/mapbox-gl.js" -}}
  {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
  {{- dict "Source" "lib/mapbox-gl/mapbox-gl-language.js" "Minify" true "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
  {{- $config = dict "accessToken" $params.mapbox.accessToken "RTLTextPlugin" "https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.0/mapbox-gl-rtl-text.js" | dict "mapbox" | merge $config -}}
{{- end -}}

{{- /* Music */ -}}
{{- if (.HasShortcode "aplayer") | or (.HasShortcode "music") -}}
  {{- /* APlayer */ -}}
  {{- $source := $cdn.aplayerCSS | default "lib/aplayer/APlayer.min.css" -}}
  {{- dict "Source" $source "Fingerprint" $fingerprint "Preload" true | dict "Page" . "Data" | partial "store/style.html" -}}
  {{- $options := dict "targetPath" "lib/aplayer/dark.min.css" "enableSourceMap" true -}}
  {{- dict "Source" "lib/aplayer/dark.scss" "ToCSS" $options "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "store/style.html" -}}
  {{- $source := $cdn.aplayerJS | default "lib/aplayer/APlayer.min.js" -}}
  {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}

  {{- if .HasShortcode "aplayer" -}}
    {{- $options := dict "targetPath" "js/lib/aplayer.min.js" "minify" hugo.IsProduction -}}
    {{- if not hugo.IsProduction -}}
      {{- $options = dict "sourceMap" "external" | merge $options -}}
    {{- end -}}
    {{- dict "Source" (resources.Get "js/lib/aplayer.js") "Build" $options "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
  {{- end -}}
  {{- if .HasShortcode "music" -}}
    {{- /* MetingJS */ -}}
    {{- $source := $cdn.metingJS | default "lib/meting/Meting.min.js" -}}
    {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
  {{- end -}}
{{- end -}}

{{- /* Tabs and tab */ -}}
{{- if .Store.Get "hasTabs" -}}
  {{- $source := $cdn.tabContainerElementJS | default "lib/tab-container-element/bundle.min.js" -}}
  {{- dict "Source" $source "Fingerprint" $fingerprint "Attr" `type="module"` "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
{{- end -}}

{{- /* Cookie Consent */ -}}
{{- if .Site.Params.cookieconsent | and .Site.Params.cookieconsent.enable -}}
  {{- $source := $cdn.cookieconsentCSS | default "lib/cookieconsent/cookieconsent.min.css" -}}
  {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "store/style.html" -}}
  {{- $source := $cdn.cookieconsentJS | default "lib/cookieconsent/cookieconsent.min.js" -}}
  {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
  {{- $cookieconsentConfig := dict "popup" (dict "background" "#1aa3ff") "button" (dict "background" "#f0f0f0") | dict "theme" "edgeless" "palette" -}}
  {{- $cookieconsentConfig = .Site.Params.cookieconsent | merge $cookieconsentConfig -}}
  {{- $cookieconsentConfig = dict "message" ($cookieconsentConfig.content.message | default (T "assets.cookieconsentMessage")) "dismiss" ($cookieconsentConfig.content.dismiss | default (T "assets.cookieconsentDismiss")) "link" ($cookieconsentConfig.content.link | default (T "assets.cookieconsentLink")) | dict "content" | merge $cookieconsentConfig -}}
  {{- $config = $cookieconsentConfig | dict "cookieconsent" | merge $config -}}
{{- end -}}

{{- /* PanguJS */ -}}
{{- if eq .Site.Params.pangu.enable true -}}
  {{- $source := $cdn.panguJS | default "lib/pangu/pangu.min.js" -}}
  {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
  {{- $config = dict "pangu" .Site.Params.pangu | merge $config -}}
{{- end -}}

{{- /* Watermark */ -}}
{{- if eq .Site.Params.watermark.enable true -}}
  {{- $source := $cdn.cellWatermarkJS | default "lib/cell-watermark/watermark.min.js" -}}
  {{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
  {{- $watermarkConfig := .Site.Params.watermark | default dict -}}
  {{- $watermarkConfig = dict
    "appendTo" ".widgets"
    "content" ($watermarkConfig.content | default $author.name | default .Site.Title)
    "rowSpacing" $watermarkConfig.rowSpacing
    "colSpacing" $watermarkConfig.colSpacing
    "fontSize" $watermarkConfig.fontSize
    "fontFamily" $watermarkConfig.fontFamily
    | merge $watermarkConfig
  -}}
  {{- $config = dict "watermark" $watermarkConfig | merge $config -}}
{{- end -}}

{{- /* Content Decryption */ -}}
{{- $encryptPartial := .HasShortcode "fixit-encryptor" -}}
{{- if $params.password | or $encryptPartial -}}
  {{- $cryptoCoreJS := $cdn.cryptoCoreJS | default "lib/crypto-js/core.js" -}}
  {{- $cryptoEncBase64JS := $cdn.cryptoEncBase64JS | default "lib/crypto-js/enc-base64.js" -}}
  {{- $cryptoSha256JS := $cdn.cryptoSha256JS | default "lib/crypto-js/sha256.js" -}}
  {{- $xxhashWasmJS := $cdn.xxhashWasmJS | default "lib/xxhash-wasm/xxhash-wasm.js" -}}
  {{- dict "Source" $cryptoCoreJS "Minify" true "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
  {{- dict "Source" $cryptoEncBase64JS "Minify" true "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
  {{- dict "Source" $cryptoSha256JS "Minify" true "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
  {{- dict "Source" $xxhashWasmJS "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
  {{- /* Decryption script */ -}}
  {{- $options := dict "targetPath" "js/fixit-decryptor.min.js" "minify" hugo.IsProduction -}}
  {{- if not hugo.IsProduction -}}
    {{- $options = dict "sourceMap" "external" | merge $options -}}
  {{- end -}}
  {{- dict "Source" (resources.Get "js/fixit-decryptor.js") "Build" $options "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
  {{- $config = dict "all" (isset $params "password") "shortcode" ($encryptPartial | default false) | dict "encryption" | merge $config -}}
{{- end -}}

{{- /* 不蒜子 */ -}}
{{- if .Site.Params.busuanzi.enable | and hugo.IsProduction -}}
  {{- $source := .Site.Params.busuanzi.source | default "https://vercount.one/js" -}}
  {{- dict "Source" $source "Fingerprint" $fingerprint "Async" true "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
{{- end -}}

{{- /* Site creation time */ -}}
{{- $siteTime := .Site.Store.Get "siteTime" -}}
{{- if $siteTime.enable -}}
  {{- with $siteTime.value -}}
    {{- $config = dict "siteTime" . | merge $config -}}
  {{- end -}}
{{- end -}}

{{- /* PWA */ -}}
{{- if not hugo.IsServer | and .Site.Params.enablePWA | and hugo.IsProduction -}}
  {{- $options := dict "targetPath" "service-worker.min.js" "minify" true -}}
  {{- $source := resources.Get "js/service-worker.js" | js.Build $options -}}
  {{- $_ := $source.RelPermalink -}}
  {{- $config = dict "enablePWA" .Site.Params.enablePWA | merge $config -}}
{{- end -}}

{{- /* Auto Bookmark */ -}}
{{- if eq .Kind "page" -}}
  {{- with $params.autoBookmark -}}
    {{- $config = dict "autoBookmark" . | merge $config -}}
  {{- end -}}
{{- end -}}

{{- /* PACE */ -}}
{{- if eq .Site.Params.pace.enable true -}}
  {{- $paceJS := "" -}}
  {{- $paceCSS := "" -}}
  {{- with ($cdn.paceJS | default "lib/pace") -}}
    {{- $paceJS = printf "%v/pace.min.js" . -}}
    {{- if $.Site.Params.pace.color | and $.Site.Params.pace.theme -}}
      {{- $paceCSS = printf "%v/themes/%v/pace-theme-%v.css" .  $.Site.Params.pace.color $.Site.Params.pace.theme  -}}
    {{- else -}}
      {{- $paceCSS = printf "%v/pace-theme-default.min.css" . -}}
    {{- end -}}
  {{- end -}}
  {{- dict "Source" $paceJS "Fingerprint" $fingerprint "Async" true "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
  {{- dict "Source" $paceCSS "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "store/style.html" -}}
  {{- /* To patch pace theme flat-top z-index error */ -}}
  {{- if eq $.Site.Params.pace.theme "flat-top" -}}
    {{- dict "Source" "lib/pace/pace-patch-flat-top.css" "Fingerprint" $fingerprint | dict "Page" . "Data" | partial "store/style.html" -}}
  {{- end -}}
{{- end -}}

{{- /* PostChat */ -}}
{{- partial "plugin/post-chat-ai.html" . -}}

{{- range $params.library.css -}}
  {{- dict "Source" . "Fingerprint" $fingerprint | dict "Page" $ "Data" | partial "store/style.html" -}}
{{- end -}}

{{- range $params.library.js -}}
  {{- dict "Source" . "Fingerprint" $fingerprint "Defer" true | dict "Page" $ "Data" | partial "store/script.html" -}}
{{- end -}}

{{- /* Config scripts */ -}}
{{- $configJS := $config | jsonify | printf "window.config=%s;" -}}
{{- if hugo.IsServer -}}
  {{- $configJS = add $configJS "console.log('Page config:', window.config);" -}}
{{- end -}}
{{- $targetPath := "" -}}
{{- if $uniqueFileId -}}
  {{- $targetPath = printf "%s/js/config/%s.js" $languagePrefix $uniqueFileId -}}
{{- end -}}
{{- dict "Content" $configJS "Path" $targetPath "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}

{{- /* MathJax plugin */ -}}
{{- if .Store.Get "hasMathJax" -}}
  {{- $targetPath := "" -}}
  {{- if $uniqueFileId -}}
    {{- $targetPath = printf "%s/js/lib/mathjax/%s.min.js" $languagePrefix $uniqueFileId -}}
  {{- end -}}
  {{- $options := dict "targetPath" $targetPath "minify" hugo.IsProduction -}}
  {{- if not hugo.IsProduction -}}
    {{- $options = dict "sourceMap" "external" | merge $options -}}
  {{- end -}}
  {{- dict "Source" (resources.Get "js/lib/mathjax.js") "Build" $options "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
{{- end -}}

{{- /* Mermaid plugin */ -}}
{{- if .Store.Get "hasMermaid" -}}
  {{- $options := dict "Source" "js/lib/mermaid.js" "Template" "js/lib/mermaid.js" -}}
  {{- $options = dict "Context" . "Minify" hugo.IsProduction "Fingerprint" $fingerprint "Attr" `type="module"` | merge $options -}}
  {{- $options | dict "Page" $ "Data" | partial "store/script.html" -}}
{{- end -}}

{{- /* Theme script */ -}}
{{- $options := dict "targetPath" "js/theme.min.js" "minify" hugo.IsProduction -}}
{{- if not hugo.IsProduction -}}
  {{- $options = dict "sourceMap" "external" | merge $options -}}
{{- end -}}
{{- dict "Source" (resources.Get "js/theme.js") "Build" $options "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}

{{- /* Custom Assets */ -}}
{{- block "custom-assets" . }}{{ end -}}

{{- /* Custom script */ -}}
{{- with ((resources.Get "js/custom.js") | default (resources.Get "js/_custom.js")) -}}
  {{- $options := dict "targetPath" "js/custom.min.js" "minify" hugo.IsProduction -}}
  {{- if not hugo.IsProduction -}}
    {{- $options = dict "sourceMap" "external" | merge $options -}}
  {{- end -}}
  {{- dict "Source" . "Build" $options "Fingerprint" $fingerprint "Defer" true | dict "Page" $ "Data" | partial "store/script.html" -}}
{{- end -}}

{{- with .Store.Get "styleArr" -}}
  {{- $content := delimit . " " -}}
  {{- $path :=  printf "%s/css/page/%s.scss" $languagePrefix $uniqueFileId -}}
  {{- $options := printf "css/page/%s.min.css" $uniqueFileId | dict "targetPath" -}}
  {{- dict "Content" $content "Path" $path "ToCSS" $options | dict "Page" $ "Data" | partial "store/style.html" -}}
{{- end -}}

{{- with .Store.Get "scriptArr" -}}
  {{- $content := delimit . "\n" -}}
  {{- $targetPath := printf "%s/js/page/%s.js" $languagePrefix $uniqueFileId -}}
  {{- dict "Content" $content "Path" $targetPath "Defer" true | dict "Page" $ "Data" | partial "store/script.html" -}}
{{- end -}}

{{- range (.Store.Get "this").style -}}
  {{- partial "plugin/style.html" . -}}
{{- end -}}

{{- range (.Store.Get "this").script -}}
  {{- partial "plugin/script.html" . -}}
{{- end -}}

{{- partial "plugin/analytics.html" . -}}
